<?php
	require ("header.php");
	//include ("../config/conn.php");
	if($ad_check<1){
	header ("Location:../login.php?action=0");
	}
?>

<style type="text/css">
<!--
body,td,th {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 11px;
	color: #000000;
}
.style1 {
	font-size: 18px;
	font-weight: bold;
	color: #f5850c;
}
.style6 {color: #000000}
-->
</style></head>
<?php
	$sql_fetch_sem="SELECT sem_num FROM semester ORDER BY sem_num ASC";
	$result=mysql_query($sql_fetch_sem);
	$sql_fetch_course="SELECT dep_name,dep_code FROM deparment ORDER BY dep_name ASC";
	$result2=mysql_query($sql_fetch_course);
	$sql_get_dep="SELECT ad_department FROM admin WHERE ad_name='$who'";
	$result3=mysql_query($sql_get_dep);
	$dep_data=mysql_fetch_assoc($result3);
	$department=$dep_data['ad_department'];
	$sql_get_subject="SELECT * FROM subject WHERE sub_department='$department'";
	$result4=mysql_query($sql_get_subject);
	$num_row=mysql_num_rows($result4);
?>
<div align="center">
  <table width="600" border="0" bordercolor="#000000">
  <form name="question_reg" method="POST" action="engine/quest_reg_engine.php">
    <tr>
      <td><p align="center" class="style1">QUESTION CREATOR FORM </p>
        <table width="553" border="0" align="center">
          <tr>
            <td width="181" valign="top"><div align="left" class="style6">Subject</div></td>
            <td width="36" valign="top"><div align="left" class="style6">:</div></td>
            <td width="322" valign="top"><div align="left" class="style6">
              <select name="q_subject">
			  <option></option>
			  <?php if ($num_row>0) {
			  while ($sub = mysql_fetch_assoc($result4)) { ?>
                <option value="<?php echo $sub['sub_code']; ?>"><?php echo $sub['sub_name']; ?></option>
                  <?php } }else { ?>
				 <option>No Subject registered</option>
				 <?php } ?>
              </select>
              </div></td>
          </tr>
          <tr>
            <td valign="top"><div align="left" class="style6">Department</div></td>
            <td valign="top"><div align="left" class="style6">:</div></td>
            <td valign="top"><div align="left" class="style6">
              <select name="q_course" id="q_course">
			  	<option></option>
                <?php while ($dep = mysql_fetch_assoc($result2)) { ?>
                <option value="<?php echo $dep['dep_code']; ?>"><?php echo $dep['dep_name']; ?></option>
                  <?php } ?>
              </select>
            </div></td>
          </tr>
          <tr>
            <td valign="top"><div align="left" class="style6">Semester</div></td>
            <td valign="top"><div align="left" class="style6">:</div></td>
            <td valign="top"><div align="left" class="style6">
              <select name="q_sem" id="q_sem" >
			  	<option></option>
                <?php while ($sem = mysql_fetch_assoc($result)) { ?>
                <option value="<?php echo $sem['sem_num']; ?>"><?php echo $sem['sem_num']; ?></option>
                  <?php } ?>
              </select>
            </div></td>
          </tr>
          <tr>
            <td valign="top"><div align="left" class="style6">Topic</div></td>
            <td valign="top"><div align="left" class="style6">:</div></td>
            <td valign="top"><div align="left" class="style6">
              <input name="q_topic" type="text" id="q_topic" size="50"/>
            </div></td>
          </tr>
          <tr>
            <td valign="top"><div align="left" class="style6">Question</div></td>
            <td valign="top"><div align="left" class="style6">:</div></td>
            <td valign="top"><div align="left" class="style6">
              <textarea name="q_question" cols="38" rows="5" id="q_question"></textarea>
            </div></td>
          </tr>
          <tr valign="middle">
            <td colspan="3"><div align="left" class="style6">
              <hr />
            </div>              <div align="left" class="style6"></div>              <div align="left" class="style6"></div></td>
            </tr>
          <tr valign="top">
            <td valign="top"><div align="left" class="style6">
              <p>Answer</p>
              </div></td>
            <td valign="top"><p class="style6">:</p>            </td>
            <td valign="top"><p align="left" class="style6">
                <input name="answer1" type="text" id="answer1" size="20" />
                This should be the answer.</p>
              <p align="left" class="style6">
                <input name="answer2" type="text" id="answer2" size="20" /> 
                This is the wrong answer.</p>
              <p align="left" class="style6">
                <input name="answer3" type="text" id="answer3" size="20" />
              This is the wrong answer.</p>
              <p align="left" class="style6">
                <input name="answer4" type="text" id="answer4" size="20" /> 
              This is the wrong answer.</p></td>
          </tr>
        </table>
        <p>&nbsp;</p>
        <p align="center">
          <input type="submit" name="Submit" value="Submit" />&nbsp;&nbsp;
          <input type="reset" name="Submit2" value="Reset" />
        </p>
        <p align="center">&nbsp;</p>      </td>
    </tr>
	</form>
  </table>
</div>
<?php require ("footer.php"); ?>
